Skip to content

Validate disc version as part of file selection#8

Open
lilDavid wants to merge 1 commit into
UltiNaruto:mainfrom
lilDavid:format_check
Open

Validate disc version as part of file selection#8
lilDavid wants to merge 1 commit into
UltiNaruto:mainfrom
lilDavid:format_check

Conversation

@lilDavid

@lilDavid lilDavid commented May 27, 2026

Copy link
Copy Markdown

Moves validation for the disc file format into the file validator in PrimeSettings. The benefit of this is it leverages AP's existing system and doesn't copy the file if it's invalid.

The file dialog also now only shows the ".iso" file extension, so the cases of file formats other than ".iso" and ".nkit.iso" should be rarer. The checks for the other file formats are still in place, though, and I also corrected the GCZ magic number check (every source I could find, including Dolphin and Randomprime's source code, have it as the 4-byte 0xB10BC001).

Comment thread src/MetroidPrimeClient.py

try:
game_version = get_version_from_iso(input_iso_path)
except FileNotFoundError:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it never will raise though since it's a ValueError that gets raised

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueError is only raised if the contents of the file are invalid. The FileNotFoundError is propagated from the open() call if the file doesn't exist at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants